package com.ruoyi.project.app.controller;

import ai.advance.cmp.api.client.bean.dto.query.OrderQueryDTO;
import ai.advance.cmp.api.client.bean.dto.query.RepaymentScheduleQueryDTO;
import com.ruoyi.project.app.util.XResult;
import com.ruoyi.project.beautyflower.FaceScoreUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


/**
 * 第三方接口模块
 */
@RestController
@RequestMapping("/app/facevalueloan/")
@Api(tags = "颜值贷模块")
public class FaceValueLoanController {
    /**
     * 颜值贷用户查询订单
     * @return
     */
    @PostMapping("queryOrderByUserId")
    @ApiOperation(notes = "queryOrderByUserId", value = "颜值贷用户查询订单")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "query", dataType = "String")
    })
    public Object queryOrderByUserId(@RequestParam @ApiIgnore Map<String, String> params)  {
        return new XResult("查询成功", FaceScoreUtil.queryOrderByUserId(params.get("userId")));
    }
    /**
     * 颜值贷查询订单还款记录
     * @return
     */
    @PostMapping("queryRepaymentRecord")
    @ApiOperation(notes = "queryRepaymentRecord", value = "颜值贷查询订单还款记录")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "query", dataType = "String")
    })
    public Object queryRepaymentRecord(@RequestParam @ApiIgnore Map<String, String> params)  {
        return new XResult("查询成功", FaceScoreUtil.queryRepaymentRecord(params.get("userId")));
    }



    /**
     * 颜值贷根据订单号查询订单信息
     * @param params
     * @return
     */
    @PostMapping("FaceScoreQueryOrderResult")
    @ApiOperation(notes = "FaceScoreQueryOrderResult", value = "颜值贷根据订单号查询订单信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", required = true, paramType = "query", dataType = "string"),
            @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "query", dataType = "string")
    })
    public Object FaceScoreQueryOrderResult(@RequestParam @ApiIgnore Map<String, String> params, @ApiIgnore HttpServletRequest request)  {
        OrderQueryDTO orderQueryDTO=new OrderQueryDTO();
        orderQueryDTO.setOrderId(params.get("orderId"));
        orderQueryDTO.setUserId(params.get("userId"));
        return new XResult("查询成功", FaceScoreUtil.queryOrderResult(orderQueryDTO));
    }


    /**
     * 颜值贷根据订单号查询还款计划
     * @param params
     * @return
     */
    @PostMapping("FaceScoreQueryRepaymentScheduleResult")
    @ApiOperation(notes = "FaceScoreQueryRepaymentScheduleResult", value = "颜值贷根据订单号查询还款计划")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", value = "订单id", required = true, paramType = "query", dataType = "string"),
            @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "query", dataType = "string")
    })
    public Object FaceScoreQFaceScoreQueryRepaymentScheduleResult(@RequestParam @ApiIgnore Map<String, String> params, @ApiIgnore HttpServletRequest request)  {
        RepaymentScheduleQueryDTO repaymentScheduleQueryDTO =new RepaymentScheduleQueryDTO();
        repaymentScheduleQueryDTO.setOrderId(params.get("orderId"));
        repaymentScheduleQueryDTO.setUserId(params.get("userId"));
        return new XResult("查询成功", FaceScoreUtil.queryRepaymentScheduleResult(repaymentScheduleQueryDTO));
    }

    /**
     * 颜值贷用户查询还款计划列表
     * @param params
     * @return
     */
    @PostMapping("queryNoRepaymentRecord")
    @ApiOperation(notes = "queryNoRepaymentRecord", value = "颜值贷用户查询还款计划列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id", required = true, paramType = "query", dataType = "string")
    })
    public Object queryNoRepaymentRecord(@RequestParam @ApiIgnore Map<String, String> params, @ApiIgnore HttpServletRequest request)  {
        return new XResult("查询成功", FaceScoreUtil.queryNoRepaymentRecord(params.get("userId")));
    }
}
